<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--js如何创造 对象 是利用 自己的默认构造器还是重写构造器-->
    <script>
        /*自己有构造器*/
        function person(firstName,secondName,age,eyeColor,location){
            this.firstName=firstName;
            this.secondName=secondName;
            this.age=age;
            this.eyeColor=eyeColor;
            this.location=location;
        }
        // key不可以打引号   value 都需要打引号。数组里面全是对象，每个对象用逗号隔开。
        var man1=new person("li","kun",13,"black",
                {address:{province:"liaoNing",city:"DaLian"},
                    internet:[{google:"ss"},{雅虎:"ww"}]
                });
        //定义一个函数   ；
        man1.changeName=function () {
            this.firstName="changeName"
            console.log(this);
            alert("chanegeName")
        }
        //默认的构造器
        var girl={
            name:"xiaolongNv",
            age:"23",
            pretty:"yes",
            address:[
                {province:"henan",city:"zhouKou"},
                {province:"shenyang",city:"DaLian"}
                 ]
            }
        document.write("man1.age="+man1.age+","+"man1.location.address.province="+man1.location.address.province)
        //用对象名+方法名（记得方法名后面要加括号，和java调用方法一样。）
        console.log(man1.changeName());
        console.log(girl);
    </script>
</head>
<body>

</body>
</html>